﻿using System.Collections.Generic;
using NPMonitor.DataModel;

namespace NPMonitor.Interfaces
{
    public interface IWorkflowStore
    {
        /// <summary>
        /// Get count of workflow containing specific job
        /// </summary>
        /// <param name="jobId"></param>
        /// <returns></returns>
        List<WorkflowJobData> GetWorkflowsContainSpecificJob(int jobId);

        /// <summary>
        /// 根据workflowId获取Workflow下的所有job
        /// </summary>
        /// <param name="workflowId"></param>
        /// <returns></returns>
        List<WorkflowJobData> GetWorkflowJobDataByWorkflowId(int workflowId);

        /// <summary>
        /// 保持Workflow信息，及Workflow下的job记录
        /// </summary>
        /// <param name="workflowData"></param>
        /// <param name="jobItems"></param>
        /// <returns></returns>
        void SaveWorkflowInfo(WorkflowData workflowData, List<WorkflowJobItem> jobItems);

        /// <summary>
        /// 根据Workflow id 获取Workflow信息
        /// </summary>
        /// <param name="workflowId"></param>
        /// <returns></returns>
        WorkflowData GetWorkflowDataById(int workflowId);

        /// <summary>
        /// 根据Workflow name 获取Workflow信息
        /// </summary>
        /// <param name="workflowName"></param>
        /// <returns></returns>
        WorkflowData GetWorkflowDataByName(string workflowName);

        /// <summary>
        /// get workflow count
        /// </summary>
        /// <returns></returns>
        int GetCountofWorkflow();

        /// <summary>
        /// get workflow info
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        List<WorkflowData> GetAllWorkflow(int pageIndex, int PageSize);

        /// <summary>
        /// delete workflow by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool DeleteWorkflow(int id);

        JobData CreateTempJobData(WorkflowJobData wfJob);
    }
}
